package com.easycms.web.monitor.service;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.easycms.framework.domain.DataTableDto;
import com.easycms.web.monitor.domain.MonitorJob;
import com.easycms.web.monitor.mapper.MonitorJobMapper;
import com.easycms.web.system.domain.SysPosition;
import com.easycms.web.system.mapper.SysPositionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public  class MonitorJobService{
    @Autowired
    private MonitorJobMapper jobMapper;

    /**
     *
     * @author yushuo
     * @description //任务列表
     * @date 16:38 2021/2/1
     * @param [dto, roleName, roleCode]
     * @return com.easycms.framework.domain.DataTableDto
     **/
    public DataTableDto getPageList(DataTableDto dto){
        LambdaQueryWrapper<MonitorJob> query=new LambdaQueryWrapper<>();
//        if(!StrUtil.isEmpty(postName)){
//            query.like(SysPosition::getPostName,postName.trim());
//        }
//        if(!StrUtil.isEmpty(postCode)){
//            query.like(SysPosition::getPostCode,postCode.trim());
//        }
        query.orderByAsc(MonitorJob::getJobId);
        Page<MonitorJob> page = new Page<>(dto.getPageNumber(), dto.getPageSize());
        IPage<MonitorJob> userIPage = jobMapper.selectPage(page, query);
        dto.setTotal(userIPage.getTotal());
        dto.setRows(userIPage.getRecords());
        return dto;
    }
}




